/*
This program does stuff related to Newcomb's Problem.
    Currently it asks you for the payouts from the boxes and outputs a number
    between 0 and 1 representing how accurate the predictor has to be for
    the 1-box strategy to have a greater expected value than the 2-box strategy.
*/
////////////////////////////////////////////////////////////////////////////////
#include <stdio>    //cout/cin
#include <cstdlib>  //atoi


//should come out to 0.5005 if given 1000, 1000000, 0
int NewcombThreshold(int boxA, int boxB1, int boxB2)
{
    return (boxB1 + boxA) / (boxB1 - boxA + boxB1 - boxA);
}

int main(int argc, char** argv)
{
    int boxA, boxB1, boxB2;

    cout << "How much is in box A?" << endl;
    cin >> boxA;
    cout << "How much is in box B if Omega predicts you take only box B?" << endl;
    cin >> boxB1;
    cout << "How much is in box B if Omega predicts you take both boxes?" << endl;
    cin >> boxB2;

    double acc = NewcombThreshold(int boxA, int boxB1, int boxB2);

    cout << "You should 1-box if Omega's accuracy is greater than: " << acc << endl;

    cin.get();  //wait for input before closing

    return 0;
}